package com.zlt.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.zlt.annotation.Column;
import com.zlt.annotation.Id;
import com.zlt.annotation.ManyToOne;
import com.zlt.annotation.Table;

@Table(name = "cart")
public class Cart {

    @Id(name = "cart_id")
    private int cid;// 餐桌主键id

    @ManyToOne(name = "user_id")
    @JSONField
    private User user;// 外键，用户id

    @ManyToOne(name = "details_id")
    @JSONField
    private Cart_Details cart_details;// 外键，购物车详情id

    @ManyToOne(name = "table_id")
    @JSONField
    private com.zlt.entity.Table table;// 外键，餐桌id

    @Column
    @JSONField
    private double amount;// 购物车总金额

    public Cart() {
    }

    public Cart(int cid, User user, Cart_Details cart_details, com.zlt.entity.Table table, double amount) {
        this.cid = cid;
        this.user = user;
        this.cart_details = cart_details;
        this.table = table;
        this.amount = amount;
    }

    public int getCid() {
        return cid;
    }

    public void setCid(int cid) {
        this.cid = cid;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public Cart_Details getCart_details() {
        return cart_details;
    }

    public void setCart_details(Cart_Details cart_details) {
        this.cart_details = cart_details;
    }

    public com.zlt.entity.Table getTable() {
        return table;
    }

    public void setTable(com.zlt.entity.Table table) {
        this.table = table;
    }

    public double getAmount() {
        return amount;
    }

    public void setAmount(double amount) {
        this.amount = amount;
    }

    @Override
    public String toString() {
        return "Cart{" +
                "cid=" + cid +
                ", user=" + user +
                ", cart_details=" + cart_details +
                ", table=" + table +
                ", amount=" + amount +
                '}';
    }
}
